# -*- coding: utf-8 -*-
from jmcomic import *
import sys
import io
sys.stdout.reconfigure(encoding='utf-8')
def main():
    sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8')
    input_data = sys.stdin.readline().strip()
    output_buffer = []  # 用于存储所有输出内容
    print(f"接收到输入: {input_data}")
    client = JmOption.default().new_jm_client()
    # 获取第一页内容作为基准
    first_page: JmSearchPage = client.search_site(search_query=f'{input_data}', page=1)
    first_page_content = [(album_id, title) for album_id, title in first_page]
    # 存储第一页内容到缓冲区
    for album_id, title in first_page_content:
        output_buffer.append(f'[{album_id}]: {title}')

    # 自动翻页逻辑
    current_page = 2
    previous_page_content = first_page_content  # 保存上一页内容用于比较

    while True:
        # 获取下一页内容
        next_page: JmSearchPage = client.search_site(search_query=f'{input_data}', page=current_page)
        next_page_content = [(album_id, title) for album_id, title in next_page]
        # 比较当前页内容是否与上一页相同
        if next_page_content == previous_page_content:
            break
        # 存储当前页内容到缓冲区
        for album_id, title in next_page_content:
            output_buffer.append(f'[{album_id}]: {title}')
        # 更新上一页内容为当前页
        previous_page_content = next_page_content
        current_page += 1
    # 所有查询完成后一次性输出
    print('\n'.join(output_buffer))
if __name__ == "__main__":
    main()